/**
 * 加载指定目录下的模块文件
 */

 const fs = require('fs');
 const path = require('path');

module.exports = function (dir) {
    patcher = {}

    fs.readdirSync(dir).forEach(function (filename) {
        if (!/\.js$/.test(filename)) {
            return;
        }
        var name = path.basename(filename, '.js');
        var scriptContent = fs.readFileSync(dir + '/' + filename, "utf-8");
        patcher[name] = scriptContent;
    });

    return patcher;
}